package com.you07.learn.service.impl;

import com.you07.learn.entity.UserEntity;
import com.you07.learn.repository.UserRepository;
import com.you07.learn.service.UserServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigInteger;
import java.util.List;

/**
 * @author chenguo
 * @version 1.0
 * @explain${EXPLAIN}
 * @create 2019年01月30日 23时:51分
 */
@Service
@Transactional
public class UserServiceImpl implements UserServiceI {

    @Autowired
    private UserRepository userRepository;


    @Override
    public UserEntity save(UserEntity userEntity) {
        return userRepository.save(userEntity);
    }

    @Override
    public List<UserEntity> list() {
        return (List<UserEntity>) userRepository.findAll();
    }

    @Override
    public UserEntity findById(BigInteger id) {
        return userRepository.findOne(id);
    }
}
